//
//  CLCoveryController.m
//  chanlin
//
//  Created by Ryan on 14-12-23.
//  Copyright (c) 2014年 chanlin. All rights reserved.
//

#import "CLCoveryController.h"
#import "CLPushWindow.h"
#import "OLImageView.h"
#import "OLImage.h"

@interface CLCoveryController ()

@property (nonatomic,strong) UIImageView *covery1;
@property (nonatomic,strong) UIImageView *covery2;

@property (nonatomic,strong) OLImageView *gifView;

@end

@implementation CLCoveryController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
    self.covery1=[[UIImageView alloc] init];
    self.covery1.frame=self.view.bounds;
    self.covery1.image=(GlobleHeight==568)?[UIImage imageNamed:@"Default-568h@2x.png"]:[UIImage imageNamed:@"Default@2x.png"];
    [self.view addSubview:self.covery1];
    self.covery1.alpha=1;
    NSLog(@"%f",GlobleHeight);
    //if([self.titleStr hasPrefix:@"加载动画"] &&(GlobleHeight>480)){
    if(YES){
        self.gifView=[[OLImageView alloc] initWithFrame:self.covery1.bounds];
       // NSString *path=[[NSBundle mainBundle] pathForResource:@"app" ofType:@"gif"];
        OLImage *imagea=[OLImage imageNamed:@"app.gif"];
        [imagea doSetLoopCount:1];
        self.gifView.image=imagea;
        UIImageView *imgb=[[UIImageView alloc] init];
        imgb.image=[UIImage imageNamed:@"bottom.png"];
        imgb.frame=CGRectMake(0, self.covery1.bounds.size.height-98.f, GlobleWidth, 98.f);
        
        [self.gifView addSubview:imgb];
        
        [self.view addSubview:self.gifView];
        
        [self performSelector:@selector(cancle) withObject:nil afterDelay:2.8f];
    }else{
        
        self.covery2=[[UIImageView alloc] init];
        self.covery2.frame=self.view.bounds;
        self.covery2.image=self.coverImg;
        [self.view addSubview:self.covery2];
        self.covery2.alpha=0;

        [UIView animateWithDuration:0.4 animations:^{
            self.covery2.alpha=1;
        } completion:^(BOOL finished) {
            self.covery1.hidden=YES;
            
             [self performSelector:@selector(cancle) withObject:nil afterDelay:2.];
        }];
    }
    
   
    
}

- (void)cancle{
    [[CLGloble sharedInstance].pushWindow resignKeyWindow];
    [CLGloble sharedInstance].pushWindow=nil;
}






@end
